<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>大麦商城</title>
<link href="css/common.css" rel="stylesheet" type="text/css"/>
<link href="css/login.css" rel="stylesheet" type="text/css"/>
	<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
	<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
	<script src="js/damai.js"></script>


</head>
<body>
<div id="app">
	<damai>
		<div class="container login">
			<div class="span12">
				<div class="ad">
					<img src="image/login.jpg" width="500" height="330" alt="会员登录" title="会员登录">
				</div>
			</div>
			<div class="span12 last">
				<div class="wrap">
					<div class="main">
						<div class="title">
							<strong>会员登录</strong>USER LOGIN
						</div>
						<div class="title">

						</div>
						<form id="loginForm" action="login.html"  method="post" novalidate="novalidate">
							<table>
								<tbody><tr>
									<th>
										用户名:
									</th>
									<td>
										<input type="text" v-model="user.username" name="username" class="text" maxlength="20"/><span></span>
									</td>
								</tr>
								<tr>
									<th>
										密&nbsp;&nbsp;码:
									</th>
									<td>
										<input type="password" v-model="user.password" name="password" class="text" maxlength="20" autocomplete="off"/><span></span>
									</td>
								</tr>
								<tr>
									<th>
										验证码:
									</th>
									<td>
										<span class="fieldSet">
											<input type="text" id="captcha" name="captcha" class="text captcha" maxlength="4" autocomplete="off"><img id="captchaImage" class="captchaImage" src="images/vcode.jpg" title="点击更换验证码" onclick="checkImg()">
										</span>
									</td>
								</tr>
								<tr>
									<th>&nbsp;

									</th>
									<td>
										<label>
											<input type="checkbox" id="isRememberUsername" name="isRememberUsername" value="true">记住用户名
										</label>
										<label>
											&nbsp;&nbsp;<a >找回密码</a>
										</label>
									</td>
								</tr>
								<tr>
									<th>&nbsp;

									</th>
									<td>
										<input @click.prevent="login" type="submit" class="submit" value="登 录">
									</td>
								</tr>
								<tr class="register">
									<th>&nbsp;

									</th>
									<td>
										<dl>
											<dt>还没有注册账号？</dt>
											<dd>
												立即注册即可体验在线购物！
												<a href="./会员注册.htm">立即注册</a>
											</dd>
										</dl>
									</td>
								</tr>
								</tbody></table>
						</form>
					</div>
				</div>
			</div>
		</div>
	</damai>
</div>
<script>

	var v=new Vue({
		el:"#app",
		data:{
			user:{username:"",password:""}
		},
		methods:{
			login(){
				axios.post("/user/login",this.user).then(res=>{
					if(res.data.code == 1){
						location.href="/index.html";
					}else{
						alert(res.data.msg)
					}
				})
			}
		}

	})

</script>

</body></html>